#ifndef ODN_GAMESTATE_H
#define ODN_GAMESTATE_H

#include "ODN_InputDevice.h"
#include "ODN_Singleton.h"

//TODO: Look for old game with onTick and onFrame events and see how to do that here

namespace ouden {

//Interface for a game state
//Derive different game states from this class and override the functions to determine its behaviour
class CGameState : public CSingleton<CGameState>
{
public:
	
	~CGameState() 		{}
	
	virtual void enter() = 0;
	virtual void exit() = 0;
	
	virtual void pause() = 0;
	virtual void resume() = 0;
	
	virtual void keyClicked(short keycode) = 0;
	virtual void keyDown(short keycode) = 0;
	virtual void keyUp(short keycode) = 0;
	virtual void processUnBufInput(CInputDevice* input) = 0;
	virtual bool frameStarted(/*TODO: Time parameter*/ ) = 0;
	virtual bool frameEnded( ) = 0;
	
protected:
	
	void changeState(CGameState* state) { GameManager::getSingletonPtr()->changeState(state); }
	void pushState(CGameState* state) { GameManager::getSingletonPtr()->pushState(state); }
	void popState() { GameManager::getSingletonPtr()->popState(); }
	
	CGameState() 		{}
	
private:
		
};

} //namespace ouden

#endif //ODN_GAMESTATE_H
